package com.pinusmusic.dao.impl;

import com.pinusmusic.dao.MusicLanguageDao;
import com.pinusmusic.domain.MusicLanguage;
import com.pinusmusic.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class MusicLanguageDaoImpl implements MusicLanguageDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<MusicLanguage> findAllLanguage() {
        String sql = "select * from musiclanguage";
        return template.query(sql,new BeanPropertyRowMapper<>(MusicLanguage.class));
    }
}
